<div class="headertitle">
	<span class="header"><?php echo SITE_NAME; ?></span>
	<span class="header">Search</span>
	<span class="header">Results: (<?php echo $results; ?>)</span>
</div>
<?php
echo $this->Form->create("Thread");
echo $this->Form->input("searchquery", array("label" => "Search"));
echo $this->Form->end("Search");
?>
<table cellspacing="0">
	<tr>
		<th style="width: 1px"></th>
		<th style="width: 550px" colspan="2">Title</th>
		<th>Info</th>
		<th>Last Post</th>
	</tr>
	<?php foreach($threads as $thread): ?>
		<tr>
			<td><?php
					if($thread['Thread']['sticky'] == "1"){
						echo $this->Html->image('pinned.png');
					}elseif($thread['Thread']['locked'] == "1"){
						echo $this->Html->image('lock-icon.png');
					}else{
						echo $this->Html->image('forum_thread.png');
					}
				?>
			</td>
			<td valign="middle" style="width: 1px; border-right: 0px; padding-right: 0px">
				<div class="display_picturetopic">
					<?php echo $this->Html->image('/attachments/avatars/small/' . $thread['User']['user_file_path']); ?>
				</div>
			</td>
			<td valign="middle">
				<?php echo $this->Html->link($thread['Thread']['title'], array(
					"controller" => "thread",
					"action" => $thread['Thread']['id'] . "-" . Inflector::slug($thread['Thread']['title'], '-'))); ?><br />
				<div class="topics_date">
				<?php echo $thread['User']['username']; ?>
				&bull;
				<?php echo $thread['Thread']['created']; ?>
				</div>
			</td>
			<td>
				Viewed: <?php echo $thread['Thread']['views']; ?><br />
				Replies: <?php echo $thread['Thread']['reply_count']; ?>
			</td>
			<td valign="middle">
				<?php echo $thread['LastUser']['username']; ?><br />
				<div class="topics_date">
					<?php echo $thread['Thread']['lastpost_created']; ?>
				</div>
			</td>
		</tr>
	<?php endforeach; ?>
</table>